# SPDX-FileCopyrightText: Copyright (c) {{cookiecutter.year}} {{cookiecutter.copyright_holder}}.
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.24)
project({{ cookiecutter.project_slug }}_apps LANGUAGES NONE)
include(CTest)

# Register SDK-free tests here, under BUILD_TESTING and outside the language
# scope below, so they run without the SDK, a GPU, or external data.
# Tests that need the SDK belong in tests/CMakeLists.txt.
{%- set languages = cookiecutter.language.split(',') %}

{% if languages | length == 1 -%}
# The CLI's --language option sets this switch. It defaults to ON so that plain
# CMake builds include the application.
{%- else -%}
# The CLI's --language option sets these switches. They default to ON so that
# plain CMake builds include both implementations.
{%- endif %}
{%- for language in languages %}
{%- set switch = 'HOLOHUB_BUILD_' ~ language.upper() %}
{%- if not loop.first %}
{% endif %}
option({{ switch }} "Build the {{ 'C++' if language == 'cpp' else 'Python' }} application" ON)

if({{ switch }})
  add_subdirectory({{ language }})
endif()
{%- endfor %}
